package com.ruoyi.goods.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.goods.mapper.CommodityProductDetailsMapper;
import com.ruoyi.goods.domain.CommodityProductDetails;
import com.ruoyi.goods.service.ICommodityProductDetailsService;

/**
 * 商品Service业务层处理
 * 
 * @author kzc
 * @date 2024-03-09
 */
@Service
public class CommodityProductDetailsServiceImpl implements ICommodityProductDetailsService 
{
    @Autowired
    private CommodityProductDetailsMapper commodityProductDetailsMapper;

    /**
     * 查询商品
     * 
     * @param productId 商品主键
     * @return 商品
     */
    @Override
    public CommodityProductDetails selectCommodityProductDetailsByProductId(Integer productId)
    {
        return commodityProductDetailsMapper.selectCommodityProductDetailsByProductId(productId);
    }

    /**
     * 查询商品列表
     * 
     * @param commodityProductDetails 商品
     * @return 商品
     */
    @Override
    public List<CommodityProductDetails> selectCommodityProductDetailsList(CommodityProductDetails commodityProductDetails)
    {
        return commodityProductDetailsMapper.selectCommodityProductDetailsList(commodityProductDetails);
    }

    /**
     * 新增商品
     * 
     * @param commodityProductDetails 商品
     * @return 结果
     */
    @Override
    public int insertCommodityProductDetails(CommodityProductDetails commodityProductDetails)
    {
        return commodityProductDetailsMapper.insertCommodityProductDetails(commodityProductDetails);
    }

    /**
     * 修改商品
     * 
     * @param commodityProductDetails 商品
     * @return 结果
     */
    @Override
    public int updateCommodityProductDetails(CommodityProductDetails commodityProductDetails)
    {
        return commodityProductDetailsMapper.updateCommodityProductDetails(commodityProductDetails);
    }

    /**
     * 批量删除商品
     * 
     * @param productIds 需要删除的商品主键
     * @return 结果
     */
    @Override
    public int deleteCommodityProductDetailsByProductIds(Integer[] productIds)
    {
        return commodityProductDetailsMapper.deleteCommodityProductDetailsByProductIds(productIds);
    }

    /**
     * 删除商品信息
     * 
     * @param productId 商品主键
     * @return 结果
     */
    @Override
    public int deleteCommodityProductDetailsByProductId(Integer productId)
    {
        return commodityProductDetailsMapper.deleteCommodityProductDetailsByProductId(productId);
    }

    @Override
    public int addoptimization(Integer productId) {
        return commodityProductDetailsMapper.addoptimization(productId);
    }

    @Override
    public int deleteInBulk(Integer productId) {
        return commodityProductDetailsMapper.deleteInBulk(productId);
    }
}
